package com.yuexun.dhdoctor.module.meetingMaterial.model.impl;

import com.yuexun.dhdoctor.module.email.bean.MailFileBean;
import com.yuexun.dhdoctor.module.meetingMaterial.api.MeetingMaterialApi;
import com.yuexun.dhdoctor.module.meetingMaterial.bean.MeetingMaterialDetailBean;
import com.yuexun.dhdoctor.module.meetingMaterial.model.IMeetingMaterialDetailModel;
import com.yuexun.dhdoctor.util.ApiUtil;

import rx.Observable;

/**
 * Created by Administrator on 2016/11/15.
 */
public class MeetingMaterialDetailModel implements IMeetingMaterialDetailModel {

    MeetingMaterialApi api;

    private MeetingMaterialApi getApi(){
        if(api!=null){
            return  api;
        }
        return ApiUtil.getInstance().createRetrofitApi(MeetingMaterialApi.class);
    }

    @Override
    public Observable<MeetingMaterialDetailBean> inquireMeetingMaterialDetail(String sessionUuid, Long meetingMaterialId) {
       api=getApi();
        return api.inquireMeetingMaterialDetail(sessionUuid,meetingMaterialId);
    }

    @Override
    public Observable<MailFileBean> getFileDetail(String sessionUuid, String fileUuid) {
        api=getApi();
        return api.inquireFile(sessionUuid,fileUuid);
    }
}
